package com.sugar.psych.assessment.module.system.api.auth;

import com.sugar.psych.assessment.framework.common.util.object.BeanUtils;
import com.sugar.psych.assessment.module.system.api.auth.dto.AppAuthDTO;
import com.sugar.psych.assessment.module.system.enums.logger.LoginLogTypeEnum;
import com.sugar.psych.assessment.module.system.service.auth.AdminAuthService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Y.sugar
 * @since 2024/8/8 15:23
 */
@Service
public class AuthApiImpl implements AuthApi{

    @Resource
    private AdminAuthService authService;

    @Override
    public AppAuthDTO appLogin(Long userId, String username) {
        return BeanUtils.toBean(authService.appCreateTokenAfterLoginSuccess(userId, username, LoginLogTypeEnum.LOGIN_SOCIAL), AppAuthDTO.class);
    }
}
